﻿<script id="contactsActionsTmpl" type="text/x-jquery-tmpl">
    <div class="contentMenuWrapper">
      <ul class="clearFix contentMenu contentMenuDisplayAll" id="ContactsListGroupButtons" style="display: block;">
        <li class="menuAction menuActionSelectAll">
          <div class="menuActionSelect">
            <input id="SelectAllContactsCB" type="checkbox" title="${ASC.Mail.Resources.MailResource.SelectAll}" />
          </div>
          <div id="SelectAllContactsDropdown" class="down_arrow" title="${ASC.Mail.Resources.MailResource.Select}">
          </div>
        </li>
        <li class="menuAction unlockAction menuActionCreate">
          <span title="${ASC.Mail.Resources.MailScriptResource.CreateContactButton}">${ASC.Mail.Resources.MailScriptResource.CreateContactButton}</span>
        </li>
        <li class="menuAction menuActionSendEmail">
          <span title="${ASC.Mail.Resources.MailResource.ComposeLabel}">${ASC.Mail.Resources.MailResource.ComposeLabel}</span>
        </li>       
        <li class="menuAction menuActionDelete">
          <span title="${ASC.Mail.Resources.MailResource.DeleteBtnLabel}">${ASC.Mail.Resources.MailResource.DeleteBtnLabel}</span>
        </li>
        <li class="menu-action-simple-pagenav"></li>
        <li class="menu-action-on-top">
            <a class="on-top-link" onclick="javascript:window.scrollTo(0, 0) || document.querySelector('.mainPageContent').scrollTo(0, 0);">
                ${ASC.Mail.Resources.MailResource.OnTopLabel}
            </a>
        </li>
      </ul>
      <div class="header-menu-spacer">&nbsp;</div>
    </div>
</script>

<script id="contactsTmpl" type="text/x-jquery-tmpl">
    <div id="ContactsList">
        <table class="contacts_list">
            <tbody>
                {{tmpl(contacts, { htmlEncode : $item.htmlEncode}) "contactItemTmpl"}}
            </tbody>
        </table>
    </div>
</script>

<script id="contactItemTmpl" type="text/x-jquery-tmpl">
    <tr class="row with-entity-menu" data_id="{{if typeof(userName)!=='undefined'}}${userName}{{else}}${id}{{/if}}"
        type="{{if typeof(type)!=='undefined'}}${type}{{/if}}">
        <td class="checkbox {{if emails.length==0}}disable{{/if}}">
            <input type="checkbox" {{if emails.length>0}}title="${ASC.Mail.Resources.MailResource.Select}"{{else}}disabled="disabled" class="disable"{{/if}} data_id="{{if typeof(userName)!=='undefined'}}${userName}{{else}}${id}{{/if}}" />
        </td>

        <td class="avatar_container">
            <div class="contact_avatar_container{{if typeof(isShared) != 'undefined' && isShared === true}} sharedContact{{/if}}">
                <div class="contact_avatar_fake" title="${displayName}"></div>
                <img class="contact_avatar display-none" title="${displayName}" src=""
                    data-src="{{if typeof(smallFotoUrl) != 'undefined'}}${smallFotoUrl}{{else}}${avatarSmall}{{/if}}" />
            </div>
        </td>


        <td class="info">
            <span class="name" title="${$item.htmlEncode(displayName)}" contactName="${name}">
                {{if displayName == ' '}}&#160;{{else}}${$item.htmlEncode(displayName)}{{/if}}
            </span>
            {{if typeof(isCompany) == 'undefined'}}
            <span class="title" title="${$item.htmlEncode(title)}">
                ${$item.htmlEncode(title)}
            </span>
            {{else typeof(company) != 'undefined' && company != null}}
            <span class="crm_company" title="${$item.htmlEncode(company.displayName)}">
                ${ASC.Mail.Resources.MailScriptResource.CRMCompany}:&nbsp;${$item.htmlEncode(company.displayName)}
            </span>
            {{/if}}
        </td>
        <td class="emails_list">
            <div class="emails">
                {{each emails}}
                    <div class="email" isprimary="${$value.isPrimary}" title="${$value.email}" style="display:none;">
                        <span class="contactEmail" contactName="${name}">${$value.email}</span>
                    </div>
                {{/each}}
                <div class="more_lnk">
                    {{if emails.length>1}}
                        <span class="gray">${ASC.Mail.Resources.MailScriptResource.More.replace('%1', emails.length-1)}</span>
                    {{/if}}
                </div>
            </div>
        </td>

        <td class="phones_list">
            <div class="phones">
                {{each phones}}
                    <div class="phone" isprimary="${$value.isPrimary}" title="${$value.phone}" style="display:none;">
                        <span class="contactPhone">${$value.phone}</span>
                    </div>
                {{/each}}
                <div class="more_lnk">
                    {{if phones.length>1}}
                        <span class="gray">${ASC.Mail.Resources.MailScriptResource.More.replace('%1', phones.length-1)}</span>
                    {{/if}}
                </div>
            </div>
        </td>

        {{if type == "contact"}}
            <td class="tags_info">
                <div class="labels">
                    {{each tags}}
                        <span class="tag tagArrow">${$item.htmlEncode($value)}</span>
                    {{/each}}
                </div>
            </td>
        {{/if}}
        <td class="menu_column">
            <div class="entity-menu" title="${ASC.Mail.Resources.MailScriptResource.Actions}" data_id="{{if typeof(userName)!=='undefined'}}${userName}{{else}}${id}{{/if}}"></div>
        </td>
    </tr>
</script>

<script id="contactTagTmpl" type="text/x-jquery-tmpl">
    <span labelid="${id}" class="tag inactive tagArrow tag${style}" title="${$item.htmlEncode(name)}">${$item.htmlEncode(name)}</span>
</script>

